package com.wanghengzhi.design.patterns.state;

class StateMain {

    /**
     * 状态模式： 当状态改变时，类的行为也随之能发生改变
     */
    public static void main(String[] args) {
        Context context = new Context();

        StartState startState = new StartState();
        startState.doAction(context);

        System.out.println(context.getState().toString());

        StopState stopState = new StopState();
        stopState.doAction(context);

        System.out.println(context.getState().toString());
    }
}
